JBoss Community Archive (Read Only)

SwitchYard 1.0

Update BPEL component database

Overview

In BPEL component, we are using the in-memory H2 database, this page is trying to give you an example that update it to a Mysql database.

Changing database steps

Download db ANT script.

Download the db ANT script zip from here, we use the RiftSaw-3.0.0 Final release (used in SwitchYard 1.0.0.Final) as an example.

Create and install the mysql database driver.

  1. create the folder in $SwitchYard/modules/mysql/main, and then copy the mysql-connector-java-5.1.12.jar (of course, you can choose other versions, but in this page, we are using this version as an example) inside it.

  2. create a module.xml along with it, the content is like following:

    <module xmlns="urn:jboss:module:1.1" name="mysql">
       <resources>
         <resource-root path="mysql-connector-java-5.1.12.jar"/>
       </resources>
       <dependencies>
         <module name="javax.api"/>
         <module name="javax.transaction.api"/>
       </dependencies>
     </module>
  3. add the mysql driver and the datasource in standalone.xml file.

    <subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasources>
                .....
                <datasource jndi-name="java:jboss/datasources/BpelDS" enabled="true" use-java-context="true" pool-name="BpelDS">
                    <connection-url>jdbc:mysql://localhost:3306/riftsaw</connection-url>
                    <driver>mysql</driver>
                    <pool/>
                    <security>
                        <user-name>root</user-name>
                        <password>jeff</password>
                    </security>
                </datasource>
                <drivers>
                    ...
                    <driver name="mysql" module="mysql">
                        <driver-class>com.mysql.jdbc.Driver</driver-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

Update the database information, and run ANT script to populate the riftsaw schema

Go to the folder that you have extracted for db script zip that we downloaded earlier, let us call it '$dbscript'.

  1. update the jdbc properties properly in $dbscript/jdbc/mysql.properties. (for other databases, update other $database.properties file)

  2. update the build.xml file's database property as your target db, (mysql in this case)

  3. run following command to populate the schema:

    ant create.riftsaw.schema

    you should be able to view the tables via: ant db.show.tables command, and drop the database script through: ant drop.riftsaw.schema

Override the properties for bpel component in standalone.xml file

Go to the $SwitchYard/standalone/configuration/standalone.xml, find the BPELComponent, and then overriding following properties:

<module identifier="org.switchyard.component.bpel" implClass="org.switchyard.component.bpel.deploy.BPELComponent">
      <properties>
          <bpel.db.mode>EXTERNAL</bpel.db.mode>
          <db.emb.create>false</db.emb.create>
          <bpel.db.ext.dataSource>java:jboss/datasources/BpelDS</bpel.db.ext.dataSource>
          <hibernate.dialect>org.hibernate.dialect.MySQLInnoDBDialect</hibernate.dialect>
      </properties>
  </module>

Then you should be ready to start the SwitchYard, the BPEL component will use the database that you created.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:54:50 UTC, last content change 2013-08-05 10:59:10 UTC.